CxProlog - testes semanticos



STACK


stack(NONSENSE) ::: false.


stack(5) ::: false.


stack_new(X), stack(X) ::: true.


-----------------------------------


STACK_PUSH


stack_new(X), stack_push(X, term) ::: true.


stack_new(X), stack_push(X, TERM) ::: true. // funcionalidade da versao futura


-----------------------------------


STACK_POP


stack_new(X), stack_push(X, term), stack_pop(X, term) ::: true.


stack_new(X), stack_push(X, term1), stack_push(X, term2), stack_pop(X, term2), stack_pop(X, term1) ::: true.


stack_new(X), stack_pop(X, term) ::: false.



-----------------------------------


STACK_NEW


stack_new(X) ::: true.



-----------------------------------


STACK_CLEAR


stack_new(X), stack_clear(X) ::: true.


stack_new(X), stack_clear(X), stack_pop(X, term) ::: fail.

-----------------------------------


STACK_DELETE


stack_new(X), stack_delete(X) ::: true.


stack_new(X), stack_delete(X), stack_clear(X) ::: fail.

-----------------------------------



STACK_TOP


stack_new(X), stack_push(X, term), stack_top(X, term) ::: true.


stack_new(X), stack_top(X, T) ::: false.


-----------------------------------


STACK_AS_LIST


stack_new(A), stack_push(A, term1), stack_push(A, term2), stack_as_list(A, [term2,term1] ::: true.
